model{
  for (i in 1:N) {
    y[i] ~ dnorm(mu[i], inv.sigma2)
    z[i] ~ dinterval(y[i], 0)
    mu[i] <- inprod(beta, x[i, ]) + gamma[id[i]]
  }
  for (i in 1:n.var) {
    beta[i] ~ dnorm(0, 0.01)
  }
  for (i in 1:n.id) {
    gamma[i] ~ dnorm(alpha, inv.tau2)
  }
  alpha ~ dnorm(0, 0.01)
  inv.sigma2 <- pow(sigma, -2)
  sigma ~ dunif(0, 100)
  inv.tau2 <- pow(tau, -2)
  tau ~ dunif(0, 100)
}